package de.hska.pwmanager.controller;

import java.util.List;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import de.hska.pwmanager.controller.errors.ValidationException;
import de.hska.pwmanager.persistence.model.PasswordData;
import de.hska.pwmanager.transfer.model.PasswordDataTransfer;
@RequestMapping(value = "passwords")
public interface IPasswordController {

	@RequestMapping(value = "read", method = RequestMethod.GET)
	public @ResponseBody
	abstract List<PasswordData> readAll();

	
	
	
	@RequestMapping(value = "create", method = RequestMethod.POST)
	public abstract @ResponseBody void createOrUpdate(
			@RequestBody PasswordDataTransfer toCreateOrUpdate) throws ValidationException;

	@RequestMapping(value = "delete/{id}")
	public abstract @ResponseBody void delete(@PathVariable(value = "id") Long primaryKey) throws ValidationException;

	public abstract @ResponseBody void validate(PasswordDataTransfer toValidate) throws ValidationException;

	@RequestMapping(value = "password/{id}", method = RequestMethod.GET)
	public abstract @ResponseBody PasswordData readByPK(@PathVariable(value = "id") Long pk);

}